﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

namespace WoogiUI
{
    public static class ImageEx
    {
        public static void SetSprite(this GameObject t, Sprite sp)
        {
            Image item = GetImage(t);
            if (item != null)
            {
                item.sprite = sp;
            }
        }

        public static Image GetImage(this GameObject t)
        {
            if (t != null)
            {
                return t.GetComponent<Image>();
            }
            return null;
        }

        public static Sprite GetSprite(this GameObject t)
        {
            Image item = GetImage(t);
            if (item != null)
                return item.sprite;
            return null;
        }
    }
}